package com.sky.mapper;


import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressBookMapper {

    /**
     * 插入地址铺数据
     * @param addressBook
     */
    @Insert("insert into address_book (user_id, consignee, sex, phone, province_code, province_name, city_code, city_name, district_code, district_name, detail, label) VALUE " +
            "(#{userId},#{consignee},#{sex},#{phone},#{provinceCode},#{provinceName},#{cityCode},#{cityName},#{districtCode},#{districtName},#{detail},#{label})")
    public void insert(AddressBook addressBook);


    /**
     * 条件查询数据
     * @param addressBook
     * @return
     */
    //@Select("select * from address_book where id = #{id}")
    List<AddressBook>  list(AddressBook addressBook);

    /**
     * 修改数据
     * @param addressBook
     */
    void update(AddressBook addressBook);

    /**
     * 根据id查询数据
     * @param id
     * @return
     */
    @Select("select * from address_book where id = #{id}")
    AddressBook getById(Long id);
}
